package com.zsrt.java.day20161223.cg.demo02;

import java.util.Scanner;

import org.junit.Test;

public class SwitchDemo01 {
/**
 * == 230  ����
 * == 120  С��
 * == 40 �綯��
 * else ��·
 * 
 * 
 * break ����д
 * byte short int long string 
 * ֻ��һ��������
 * ���ڹ�ϵ
 * case �����һ��
 */

	@Test
	public void if01(){
		
		int speed = 1024;
		
		if(230==speed){
			System.out.println("����");
		}else if(120==speed){
			System.out.println("С��");
		}else if(40==speed){
			System.out.println("�綯��");
		}else{
			System.out.println("��·");
		}
		
	}
	
	@Test
	public void switch01(){
		
		Scanner sc = new Scanner(System.in);
		System.out.println("��������ʻ�ٶ�");
		int speed = sc.nextInt();
		sc.close();
		
		switch(speed){
		case(120):System.out.println("����"); break;
		case(40):System.out.println("��"); break;
		case(20):System.out.println("�綯��"); break;
		default:System.out.println("��·"); break;
		}
	}
		
		@Test
		public void switch02(){
			
			Scanner sc = new Scanner(System.in);
			System.out.println("�����뽻ͨ����");
			String tool = sc.next();
			sc.close();
			
			switch(tool){
			case"����":System.out.println("120"); break;
			case"��":System.out.println("40"); break;
			case"�綯��":System.out.println("20"); break;
			case"��·":System.out.println("10");break;
			default:System.out.println("20"); break;
			}
	}
}
